package com.net.sorting;

import java.util.Arrays;

public class BubbleSortTest {

	public static void main(String[] args)
	{
		
		int[] unSort = {4,2,6,11,34,75,3,9};
		
	    bubble(unSort);

	}

	private static void bubble(int[] unSort)
	{
		System.out.println("Unsorted array      " +unSort.toString());
		
		
		for(int i=0; i<unSort.length;i++)
		{
			
			for(int j = 1; j<unSort.length;j++)
			{
				if(unSort[j-1]>unSort[j])
				{
					int temp = unSort[j-1];
					unSort[j] = unSort[j-1];
					unSort[j-1] = temp;
				}
			}
			
			System.out.println("After " + i+1+ " swap  " +Arrays.toString(unSort));
		}
		
	}

}
